<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'dpt-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'dpt_code'); ?>
		<?php echo $form->textField($model,'dpt_code',array('size'=>20,'maxlength'=>20)); ?>
		<?php echo $form->error($model,'dpt_code'); ?>
	</div>
	
	<?php if (99 == Yii::app()->user->getState('userrank', NULL)) { ?>
	<div class="row">
		<?php echo $form->labelEx($model,'dpt_unit'); ?>
		<?php echo $form->textField($model,'dpt_unit',array('size'=>10,'maxlength'=>10)); ?>
		<?php echo $form->error($model,'dpt_unit'); ?>
	</div>
	<?php } else {?>
		<?php echo $form->textField($model,'dpt_unit',array('size'=>10,'maxlength'=>10,
			'value'=>Yii::app()->user->getState('userunit', NULL))); ?>
	<?php }?>
	
	<div class="row">
		<?php echo $form->labelEx($model,'dpt_parent'); ?>
		<?php echo $form->textField($model,'dpt_parent',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'dpt_parent'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'dpt_name'); ?>
		<?php echo $form->textField($model,'dpt_name',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'dpt_name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'dpt_remark'); ?>
		<?php echo $form->textField($model,'dpt_remark',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'dpt_remark'); ?>
	</div>
	
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->